﻿using System;
using UnityEngine;

namespace Valve.VR.InteractionSystem
{
	// Token: 0x0200061E RID: 1566
	public class LinearAudioPitch : MonoBehaviour
	{
		// Token: 0x0600279D RID: 10141 RVA: 0x000E6C0C File Offset: 0x000E4E0C
		private void Awake()
		{
			if (this.audioSource == null)
			{
				this.audioSource = base.GetComponent<AudioSource>();
			}
			if (this.linearMapping == null)
			{
				this.linearMapping = base.GetComponent<LinearMapping>();
			}
		}

		// Token: 0x0600279E RID: 10142 RVA: 0x000E6C48 File Offset: 0x000E4E48
		private void Update()
		{
			if (this.applyContinuously)
			{
				this.Apply();
			}
		}

		// Token: 0x0600279F RID: 10143 RVA: 0x000E6C5C File Offset: 0x000E4E5C
		private void Apply()
		{
			float t = this.pitchCurve.Evaluate(this.linearMapping.value);
			this.audioSource.pitch = Mathf.Lerp(this.minPitch, this.maxPitch, t);
		}

		// Token: 0x0400279D RID: 10141
		public LinearMapping linearMapping;

		// Token: 0x0400279E RID: 10142
		public AnimationCurve pitchCurve;

		// Token: 0x0400279F RID: 10143
		public float minPitch;

		// Token: 0x040027A0 RID: 10144
		public float maxPitch;

		// Token: 0x040027A1 RID: 10145
		public bool applyContinuously = true;

		// Token: 0x040027A2 RID: 10146
		private AudioSource audioSource;
	}
}
